Release 10.1A: OpenEdge Development:
Programming Interfaces
Authenticating OpenEdge internal user IDs and passwords
If the security administrator establishes a list of valid OpenEdge internal user IDs, then your application must prompt the user for a user ID and password at the appropriate point to establish a database connection ID. Typically, an application does this by running the standard Progress startup procedure,
_prostar.p. This procedure, in turn, runs the standard Progress authentication procedure,_login.p, for each connected database.The
_prostar.pprocedure also prepares_login.pto run appropriately in the current application environment (character or graphical) and verifies that no connected databases have the logical nameDICTDB. This allows_prostar.pto assign the same alias (DICTDB) to each connected database before calling_login.p. Then,_login.pcan authenticate access as it is called for each different database using the same database name.This is the
_login.pprocedure:
The
_login.pprocedure uses the Progress 4GLSETUSERIDfunction to check the user ID and password that the user enters. The user has three tries to enter the correct user ID and password for each database. If the user fails to do so after three tries, Progress exits the user from the database. If the user ID and password combination is valid for the database,SETUSERIDestablishes that user ID as the database connection ID.The input parameter for
_login.pallows it to display the authentication prompts either in a dialog box (viewAsDialog = TRUE) or in the frame of a separate window (viewAsDialog = FALSE). The_prostar.pprocedure uses a separate window in graphical environments and the default window in character environments, so it always passesFALSEas an argument to_login.p.As explained earlier, the
_login.pprocedure only works for a database with theDICTDBalias. (By default, this alias is assigned to the first database you connect to during a session.) If you want to avoid this restriction, you can create your own procedures, based on_prostar.pand_login.p, that pass an argument for the database name.If the application does not run
Note: You can configure how the database handles blank user IDs for both database connection and authorization for data access. The Security menu of the Data Administration tool provides an option to disallow blank user ID access to data, which procedure access at both compile-time and run-time. This menu also provides set of additional database options, including an option to disallow database connections using the blank user ID. For more information, see the sections on security in OpenEdge Deployment: Managing 4GL Applications and the Data Administration tool online help._prostar.pat connection time, or if the user bypasses_login.p(by pressing END–ERROR when prompted for the user ID and password), then the user is assigned the blank user ID. While blank user IDs can connect to the database, they cannot access data protected by compile-time and run-time authorization.If you connect to a database dynamically using the
CONNECTstatement, you can use the User ID (–U) and Password (–P) connection parameters in theCONNECTstatement, or you can use theSETUSERIDfunction directly after the connection is already established.The following procedure connects to the
myworkdatabase that has a list of valid users. The user initially connects to the database with a blank user ID. The code then enters a loop that forces the user to provide a valid user ID and password for that database:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |